import React, { useRef } from 'react'
import PubSub from 'pubsub-js';
export default function Header() {
    const inputRef = useRef()
    async function getUserList () {
        // console.log(inputRef.current.value);
        let uname = inputRef.current.value.trim()
        PubSub.publish("search", uname)
    }
  return (
    <div>
       <section className="jumbotron">
            <h3 className="jumbotron-heading">Search Github Users</h3>
            <div>
                <input ref={inputRef} type="text" placeholder="enter the name you search"/>
                <button onClick={() => {getUserList()}}>Search</button>
            </div>
        </section>
    </div>
  )
}
